package com.xjtu.se.homework.client.userInfo.impl;

import com.xjtu.se.homework.client.userInfo.UserDto;
import com.xjtu.se.homework.client.userInfo.UserInfoService;
import com.xjtu.se.homework.client.userInfo.dao.UserInfoDao;
import com.xjtu.se.homework.common.model.User.User;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
@Transactional
public class UserInfoServiceImpl implements UserInfoService {

    @Resource
    private UserInfoDao userInfoDao;

    @Override
    public UserDto getUserInfo(String u_id) {
        return userInfoDao.checkId(u_id).get(0);
    }

    @Override
    public boolean upLoadAvatar() {
        return false;
    }

    @Override
    public boolean modAvatar() {
        return false;
    }

    @Override
    public boolean searchId(String u_id) {
        return !userInfoDao.checkId(u_id).isEmpty();
    }

    @Override
    public boolean modName(String u_id, String u_name) {
        return userInfoDao.modName(u_id, u_name);
    }

    @Override
    public boolean modRole(String u_id, int role_id, String grade) {
        return userInfoDao.modRole(u_id, role_id, grade);
    }

}
